#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 405;
const int MOD = 1e9 + 7;

int n;
ll a[N][N << 1];
ll fastpow(ll b, ll p) {
  ll res = 1;
  while (p) {
    if (p & 1) res = res * b % MOD;
    b = b * b % MOD;
    p >>= 1;
  }
  return res;
}

bool solve() {
  rep(i, 0, n - 1) a[i][i + n] = 1;
  rep(i, 0, n - 1) {
    int j = i;
    while (j < n && !a[j][i]) j++;
    if (j >= n) return false;
    if (j != i) rep(k, 0, n * 2 - 1) swap(a[i][k], a[j][k]);
    ll x = fastpow(a[i][i], MOD - 2);
    rep(k, 0, n * 2 - 1) a[i][k] = a[i][k] * x % MOD;
    rep(j, 0, n - 1) {
      if (j == i) continue;
      if (a[j][i]) {
        ll y = a[j][i];
        rep(k, i, n * 2 - 1) a[j][k] =
            (a[j][k] - y * a[i][k] % MOD + MOD) % MOD;
      }
    }
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 0, n - 1) rep(j, 0, n - 1) cin >> a[i][j];
  if (solve()) {
    rep(i, 0, n - 1) {
      rep(j, n, n * 2 - 1) cout << a[i][j] << ' ';
      cout << endl;
    }
  } else {
    cout << "No Solution";
  }
  return 0;
}